#include "CEC.h"
int main()
{
    printDSH();
    initVar();
    getPath();
    readAtomMass((char *)"/atomMass");
    readCompound((char *)"/compoundData");
    readFuel((char *)"/fuelData");
    readOxidizer((char *)"/oxidizerData");
    readEngineDefinition((char *)"/engineDefinition");
    for(int i=0;i<5;i++) cout<<endl;
    calcPropellant();
    calcEleCmpToBeCalc();

    //optimum
    if(optimum==1) opt();
    //calcres
    for(int i=0;i<5;i++) cout<<endl;
    cout<<"RESULT:"<<endl;
    printMinus();cout<<endl;
    calcChamber();
    cout<<"Chamber:"<<endl;
    printRes();
    calcNozzleThroat();
    cout<<"Nozzle throat:"<<endl;
    printRes();
    if(frzFlow==1) calcNozzleExit();
    else calcNozzleExitEqm();
    cout<<"Nozzle exit:"<<endl;
    printRes();
    
    calcPerf();
    cout<<"Theoretical performance:"<<endl;
    printPerf();
    return 0;
}

int opt(void)
{
    //redirect
    ofstream fout("calc.out");
    streambuf *oldcout;
    oldcout = cout.rdbuf(fout.rdbuf());
    //calc

    //redirect
    cout.rdbuf(oldcout);
    cout<<"The optimization function is under development."<<endl;
    return 0;
}